/**
 * Copyright 2018 人人开源 http://www.renren.io
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.rf.richfitwheel.admin.sys.service;

import java.util.List;
import java.util.Map;

import com.rf.richfitwheel.admin.sys.model.Dictionary;
import com.rf.richfitwheel.common.utils.PageUtils;
import com.rf.richfitwheel.common.utils.TreeUtils;


/**
 * 字典管理
 * 
 * @author hushouquan
 * @date 2018-12-12
 */
public interface SysDicService {

	PageUtils queryPage(Map<String, Object> params);
	
	/**
	 * 保存配置信息
	 */
	public void save(Dictionary dictionary) throws Exception;
	
	/**
	 * 更新配置信息
	 */
	public void update(Dictionary dictionary) throws Exception;
	
	/**
	 * 根据key，更新value
	 */
	@Deprecated
	public void updateValueByKey(String key, String value);
	
	/**
	 * 删除配置信息
	 */
	public void deleteBatch(String[] ids);
	
	/**
	 * 根据key，获取配置的value值
	 * 
	 * @param key           key
	 */
	@Deprecated
	public String getValue(String key);
	
	/**
	 * 根据key，获取value的Object对象
	 * @param key    key
	 * @param clazz  Object对象
	 */
	@Deprecated
	public <T> T getConfigObject(String key, Class<T> clazz);
	
	/**
	 * 主键获取字典
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Dictionary selectById(String id) throws Exception;

	/**
	 * 根据字典编号获取字典值
	 * @param classCode
	 * @return
	 */
	//@Cacheable(key ="sysdic_#p0") 
	List<Dictionary> queryByClassCode(String classCode);

	/**
	 * 全部加载
	 * @return
	 */
	List<Dictionary> queryAll();
	
	/**
	 * 
	 * <p>Title: 根据字典代码加载数据字典树结构</p>  
	 * <p>Description: 数据字典本身需要支持上下级关系</p>  
	 * @param classCode 字典代码 多个用逗号隔开
	 * @return
	 * @throws Exception 
	 */
	public List<TreeUtils> getDicTreeByClassCode(String classCode) throws Exception;
	
	/**
	 * 根据字典编号获取字典值,只包含状态正常的记录 
	 * @param classCode
	 * @return
	 */
	//@Cacheable(key ="sysdic_#p0") 
	List<Dictionary> queryByClassCodeStatusNormal(String classCode);

	/**
	 * 根据字典编号获取字典值
	 * @param classCode
	 * @return
	 */
	//@Cacheable(key ="sysdic_#p0")
	Dictionary queryByClassCodeAndDataCode(String classCode,String dataCode);

}
